/**
 * Created by Administrator on 2017/5/5 0005.
 */
checkCookie()
var mid= $.cookie('mid')
var token= $.cookie('token')
var next_page=''
var data_back=false;
$(window).scroll(function () {
    var windowheight=$(window).height();//窗口高度
    var scrolltop=$('body').scrollTop();//滚动条高度
    var eh=$(document).height();//文本高度
    if(parseInt(windowheight+scrolltop)>=eh){
        $('.bot_loading').show()
            if(data_back){
                return false
            }
         data_back=true
            if(next_page==null){
                $('.bot_loading').html('没有更多啦！');
                setInterval(function () {
                    $('.bot_loading').fadeOut(800)
                },2000);
                data_back=false
            }else{
                getData({url:next_page,data:{mid:mid,token:token}}, function (data) {
                    var html = template('list', data);
                    $('.center ul').append(html)
                    $('.bot_loading').hide();
                    next_page = data.next_page_url
                    data_back=false
                })
            }

    }else{
        $('.bot_loading').hide()
    }
})


getData({url:recharge_history,data:{mid:mid,token:token}}, function (data) {
        var html=template('list',data);
        $('.center ul').html(html);
        var childs=$('.center ul').find('li')
        if(childs.length==0){
            $('.center').append('<p style="text-align: center;padding-top: 10px;font-size:15px; line-height: 360px; color: #666;">暂无数据</p>')
        }
        $('.load').hide();
        next_page=data.next_page_url
})

